﻿#include "teachersubmitcourse.h"
#include "ui_teachersubmitcourse.h"
#include <QMessageBox>
teacherSubmitCourse::teacherSubmitCourse(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::teacherSubmitCourse)
{
    ui->setupUi(this);
}

teacherSubmitCourse::~teacherSubmitCourse()
{
    delete ui;
}

QStringList teacherSubmitCourse::getInfo()
{
    return partCourseInfo;
}

void teacherSubmitCourse::clearUi()
{
    this->ui->edit_course_name->clear();
    partCourseInfo.clear();
    partCourseInfo.append("0");
}


void teacherSubmitCourse::on_btn_exit_clicked()
{
    this->close();
}

void teacherSubmitCourse::on_btn_confirm_clicked()
{
    if(this->ui->edit_course_name->text()!=""&&this->ui->spin_credit->value()!=0)
    {
        if(QMessageBox::information(this,"提示",this->ui->edit_course_name->text()+'\n'+this->ui->box_course_time_1->currentText()+this->ui->box_course_time_2->currentText(),"确认")==0)
        {
            partCourseInfo.clear();
            partCourseInfo.append(this->ui->edit_course_name->text());
            QString temp1=QString::number(this->ui->spin_credit->value(), 10);
            partCourseInfo.append(temp1);
            partCourseInfo.append(this->ui->box_course_school->currentText());
            partCourseInfo.append(this->ui->box_course_charactor->currentText());
            partCourseInfo.append(this->ui->box_course_time_1->currentText()+this->ui->box_course_time_2->currentText());
            QString temp2=QString::number(this->ui->spin_max_people->value(), 10);
            partCourseInfo.append(temp2);
            this->close();
        }
    }
    else
    {
        QMessageBox::critical(this,"提示","请填写完整的信息！","确认");
    }
}
